
#include "util.h"



HashInt hash_from_str(const char * src_str, size_t len)
{
    const unsigned char * str = (const unsigned char *)src_str;
    size_t n = len;
    HashInt h = 0;
    HashInt g;

    while (n--)
    {
        h = (h << 4) + *str++;
        if ((g = (h & 0xf0000000)) != 0)
        {
            h ^= g >> 23;
        }
        h &= ~g;
    }

    return h;
}

